<?php
require_once ('dbconfig.php');
require_once ('igb.php');

?>

<html>
<head>
<title>Corporate Ore Payout Calculator</title>
</head>
<body>

<?php
$dbh = mysql_connect ( DB_HOST, DB_USER, DB_PASS ) or die ( mysql_error () );
mysql_select_db ( DB_NAME );

echo "<h1>Corp Ore Payout Prices Page</h1> <br>";

$sql = "select * from OrePurchasePrice order by oreSeq";
$result = mysql_query ( $sql, $dbh ) or die ( mysql_error () );
$sql = "select * from OrePurchasePrice order by oreSeq";
$recCount = mysql_num_rows ( $result );

$count = 0;
//echo "<form method=POST action=\"$_SERVER[PHP_SELF]\">";
echo "<form method=POST action=testCalc2.php>";
echo "<table border=1><tr><td><b>Ore</b></td><td align=\"right\"><b>Price</b></td><td><b>Qty</b></td></tr>\n";

while ( $newArray = mysql_fetch_array ( $result ) ) {
	$oreName = $newArray ['oreName'];
	$orePrice = $newArray ['orePrice'];
	echo "<tr><td width=125 align=\"left\">$oreName</td><input type=\"hidden\" name=\"oreN[]\" value=\"".$oreName."\">";
	echo "<td align=\"right\">$orePrice</td><input type=\"hidden\" name=\"oreP[]\" value=\"".$orePrice."\">";
	echo "<td><INPUT NAME=oreQ" . $count . "></td></tr>\n";
//	echo "<td><INPUT NAME=oreQ[]></td></tr>\n";
	$count ++;
} //end of while loop
echo "</table>\n";
echo "<input type=\"hidden\" name=\"recCount\" value=\"" .$recCount."\">\n";
echo "<input type=submit name=\"submit\" value=\"Calculate\">\n";
echo "</form>\n";

?>

</body>
</html>
